import hyRequest from "@/service"

// 用户的网络请求
export function postUserListRequest(queryInfo:any) {
  return hyRequest.post({
    url: "/users/list",
    data: queryInfo
  })
}
//删除用户
export function deleteUserRequest(id:number) {
  return hyRequest.delete({
    url: `/users/${id}`,
  })
}
//添加用户
export function newUserCreate(userInfo:any) {
  return hyRequest.post({
    url: "/users",
    data: userInfo
  })
}

//编辑用户数据
export function editUserData(id:number,userInfo:any) {
  return hyRequest.patch({
    url: `/users/${id}`,
    data: userInfo
  })
}


// 针对页面数据的网络请求，增删改查
export function postPageListData(pageName:string,queryInfo:any){
  return hyRequest.post({
    url:`/${pageName}/list`,
    data:queryInfo
  })
}
//删除用户
export function deletePageByIdRequest(pageName:string,id:number) {
  return hyRequest.delete({
    url: `/${pageName}/${id}`,
  })
}
// 新建部门
export function newPageDataRequest(pageName:string,userInfo:any) {
  return hyRequest.post({
    url: `/${pageName}`,
    data: userInfo
  })
}

//编辑部门数据
export function editPageDataRequest(pageName:string,id:number,userInfo:any) {
  return hyRequest.patch({
    url: `/${pageName}/${id}`,
    data: userInfo
  })
}

